package org.example.direct;

import com.rabbitmq.client.Channel;
import org.example.utils.RabbitMqUtils;

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

/**
 * @author zfj
 * @date 2022/4/24 -16:42
 */
public class EmitLogDirect {
	private static final String EXCHANGE_NAME = "direct_logs";

	public static void main(String[] args) throws Exception {
		Channel channel = RabbitMqUtils.getChannel();
		Scanner sc=new Scanner(System.in);
		while (sc.hasNext()){
			String message=sc.nextLine();
			//发给谁取决于routingKey
			channel.basicPublish(EXCHANGE_NAME,"error",null,message.getBytes("UTF-8"));
			System.out.println("生产者发出消息："+message);
		}
	}
}
